package com.hqyj.paimaisys.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class PaimaiConfiguration implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    //配置拦截器
    //拦截登录以外的所有请求
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/huiyuan/login")
                .excludePathPatterns("/huiyuan/register")
                .excludePathPatterns("/huiyuan/validHid")
                .excludePathPatterns("/huiyuan/active")
                .excludePathPatterns("/admin/login")
                .excludePathPatterns("/admin/register");

    }
}
